// const requestQueue = []
// const isRefreshing = false

const requestInterceptor = (config) => {
  console.log('requestInterceptor >>> ', config)
  const tokenKey = import.meta.env.VITE_APP_HEADER_TOKEN_KEY
  Object.assign(config.headers, { [tokenKey]: sessionStorage.getItem('token') })
  return config
}

const requestCatchInterceptor = (err) => {
  console.log('requestCatchInterceptor >>> ', err)
  return err
}

const responseInterceptor = (response) => {
  console.log('responseInterceptor >>> ', response)
  return response.data
}

const responseCatchInterceptor = (err) => {
  console.log('responseCatchInterceptor >>> ', err)
  return err
}

export default {
  requestInterceptor,
  requestCatchInterceptor,
  responseInterceptor,
  responseCatchInterceptor
}
